// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

import GameCtrl from "./GameCtrl";
import GameView from "./GameView/GameView";

const { ccclass, property } = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

  @property(cc.Prefab)
  gameViewPrefab: cc.Prefab = null

  private m_GameCtrl: GameCtrl = null
  private m_GameView: GameView = null

  start() {
    this.m_GameView = cc.instantiate(this.gameViewPrefab).getComponent(GameView)
    this.node.addChild(this.m_GameView.node)
    this.m_GameCtrl = new GameCtrl()
    this.m_GameCtrl.Init(this.m_GameView)
    this.m_GameCtrl.Start()
  }

  // update (dt) {}
}
